package com.zhou.simulation.quartz;

import com.zhou.simulation.service.impl.MailService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ProjectName: simulation
 * @Package: com.zhou.simulation.quartz
 * @ClassName: MailJob
 * @Author: zhoujingbo
 * @Description: <p>
 * @Date: 2020/10/9 16:31
 * @Version: 1.0
 */
public class MailJob {
    public MailJob() {
        System.out.println("初始化MailJob类");
    }
    @Autowired
    private MailService mailService;

    public void execute(){
        System.out.println("开始发送邮件");
        System.out.println("线程名：" + Thread.currentThread().getName());
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "MailJob");
        mailService.sendToRabbitMQ();
    }

}
